import request from '@/utils/request'

export  function getMerchant(data) {
    return request({
        url: `/api/user/merchant/checkById`,
        //post请求
        method: 'post',
        data
    })
}



//商家id找菜系
export function getCategoryByMerchantId(data) {
    return request({
        url: `/api/category/query/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//菜系id查所有菜
export function getDish(data) {
    return request({
        url: `/api/dish/query/${data.id}/${data.merchantId}`,
        //post请求
        method: 'post',
        data
    })
}

//菜的细节信息
export function getDishDetail(data) {
    return request({
        url: `/api/dish/find/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

export function queryDishByList(data) {
    return request({
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: `/api/dish/queryByList`,
        //post请求
        method: 'post',
        data
    })
}

export function addToShoppingCart(data) {
    return request({
        url: `/api/shoppingCart/add`,
        //post请求
        method: 'post',
        data
    })
}

export function updateShoppingCart(data) {
    return request({
        url: `/api/shoppingCart/update`,
        //post请求
        method: 'post',
        data
    })
}

//删除部分菜品
export function deleteShoppingCart(data) {
    return request({
        url: `/api/shoppingCart/delete/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//删除该店所有菜品
export function deleteAllCart(data) {
    return request({
        url: `/api/shoppingCart/deleteAll/${data.userId}/${data.merchantId}`,
        //post请求
        method: 'post',
        data
    })
}

//查询菜品
export function selectShoppingCart(data) {
    return request({
        url: `/api/shoppingCart/select/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//整个购物车菜品
export function selectAllCart(data) {
    return request({
        url: `/api/shoppingCart/selectAll/${data.userId}/${data.merchantId}`,
        //post请求
        method: 'post',
        data
    })
}

//更新购物车
export function updateToShoppingCart(data) {
    return request({
        url: `/api/shoppingCart/updateById`,
        //post请求
        method: 'post',
        data
    })
}

//整个购物车菜品
export function computedOrder(data) {
    return request({
        url: `/api/orderdetail/computed`,
        //post请求
        method: 'post',
        data
    })
}

export function orderAdd(data) {
    return request({
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: `/api/order/addToOrder`,
        //post请求
        method: 'post',
        data
    })
}

//查询热门菜品
export function queryHot(data) {
    return request({
        url: `/api/dish/queryHot/${data.merchantId}`,
        //post请求
        method: 'post',
        data
    })
}




//查询热门菜品
export function getMerchantImage(data) {
    return request({
        url: `/api/user/merchant/getMerchantImage`,
        //post请求
        method: 'post',
        data
    })
}